/**Author:7rATM Team
 *Date:May 2009
 *Description: The class BankAccount models some method that provide the client some  *services
 */
package AtmSystem;
      /**
       * Constructs a <code>BankAccount</code> object.
       *
       * @param initialCardNumber  the cardNumber of the bankAccount.
       * @param initialBalance the balance of the bankAccount.
       */
public class BankAccount 
{
	private int cardNumber;
	private double balance;
	public BankAccount(int initialCardNumber, double initialBalance)
	{
		cardNumber=initialCardNumber;
		balance=initialBalance;

	}

       /**
	*get cardNumber of this BackAccount
	*
	*@return cardNumber of this BackAccount
	*/
	public int getCardNumber()
	{
		return cardNumber;
	}

       /**
	*get balance of this BackAccount
	*
	*@return balance of this BackAccount
	*/
	public double getBanlance()
	{
		return balance;
	}

    /**
     * Sets the balance of instance variable <code>newBalance</code>.
     *
     * @param balance the new balance.
     */
   public void setBalance(double newBalance)
	{
	   balance=newBalance;
	}

	public double getBalance()
	{
		return balance;
	}

    /**
     * Returns <code>true</code> if balance equals to balance plus Newdeposit
     *
     * @param object  object with which this user has deposit
     * @return  <code>true</code> 
     */
	public boolean deposit(double newDeposit)
	{
		
			balance = balance + newDeposit;
			return true;
	}

    /**
     * Returns <code>false</code> if balance < newWithdraw
     *
     * @param object  object with which this user want to withdraw
     * @return  <code>false</code> if balance < newWithdraw;
     *balance=balance - newWithdraw return <code>ture</code> otherwise.
     */
	public boolean withdraw(double newWithdraw)
	{
		if (balance < newWithdraw)
			return false;
		else 
		{
			balance = balance - newWithdraw;
			return true;
		}
	}
}
